/*
 * @Author: dengzhijun 1726768643@qq.com
 * @Date: 2025-01-17 09:30:23
 * @LastEditors: dengzhijun 1726768643@qq.com
 * @LastEditTime: 2025-01-24 10:11:58
 * @FilePath: /Tools/Tool/Logger.h
 * @Description: 
 * Copyright (c) 2025 by ${dengzhijun} email: ${1726768643@qq.com}, All Rights Reserved.
 */
#ifndef LOGGER_H
#define LOGGER_H

#include <iostream>
#include <string>
#include <thread>
#include <atomic>
#include <fstream>
#include <memory>
#include <filesystem>
#include <cstdarg>
#include "include/ILogger.h"

namespace Tool
{
    struct LoggerPrivater;
    class ExportAPI Logger : public ILogger
    {
    public:
        Logger();
        virtual ~Logger();
        inline virtual void Write(const char *fileName, int lineNumber, LogLevel level, std::string logerName, const char *format, ...) override;
        virtual void SetOutputToConsole(bool output) override;
        virtual void SetLevel(LogLevel level) override;
    private:
        Logger(const Logger &) = delete;
        Logger &operator=(const Logger &) = delete;
        bool Init(const std::string &logPath, const std::string &logFileName, bool outputToConsole = true,
                  LogLevel level = LogLevel::Debug, int asyncLogSize = 400, int logBufSize = 1024, int splitLines = 50000);
        void UnInit();
        void AsyncWriteLog();
        inline std::string GetLogFileName();

    private:
        LoggerPrivater *m_privater = nullptr;
    };

}
#endif // LOGGER_H
